//
//  SurroundDetailViewController.m
//  YouGoWeGo
//
//  Created by Dai on 14/11/25.
//  Copyright (c) 2014年 LiuFei. All rights reserved.
//

#import "SurroundDetailViewController.h"

@interface SurroundDetailViewController ()<UIWebViewDelegate>

@end

@implementation SurroundDetailViewController
- (void)dealloc
{
    [_backButton release];
    [super dealloc];
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.translucent = NO;
    [self.view setBackgroundColor:[UIColor whiteColor]];
  
    UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://breadtrip.com/tp/customization/%ld/", self.getID]]];
    [self.view addSubview:web];
    [web loadRequest:request];
    web.delegate = self;
    
    [self creatButton];
    
    
}
- (void)creatButton
{
    self.backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 80, 30)];
    [self.backButton setTitle:@"<<返回" forState:UIControlStateNormal];
//    [_backButton setBackgroundColor:[UIColor yellowColor]];
//    [_backButton setTitleEdgeInsets:[UIEdgeInsetsMake(0, -20, 0, 0)]];
//    _backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    
    
    //button title左对齐
    _backButton.contentEdgeInsets = UIEdgeInsetsMake(0.0, -50.0, 0.0, 0.0);
    [self.backButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.backButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_backButton];
    [_backButton release];

}
#pragma mark - 
#pragma mark - BUTTON事件
- (void)buttonAction:(id)sender
{
    
    [self.navigationController popViewControllerAnimated:YES];

}


#pragma mark - 
#pragma mark - GET ID
- (void)getID:(NSInteger)ID
{
    self.getID = ID;

}
- (void)didReceiveMemoryWarning
{

    [super didReceiveMemoryWarning];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{


}
- (void)webViewDidStartLoad:(UIWebView *)webView
{


}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    NSLog(@"error%@", error);

}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
